<template>
    <div class="common-layout">
        <el-container>
            <el-header><HeaderView></HeaderView></el-header>
            <el-container>
                <el-aside width="200px">侧边</el-aside>
                <el-main>
                    <div>
                        主页,用户名: {{ store.token == '' ? '请登录' : store.token }}
                        <br>
                        <el-button type="primary" @click="gotoLogin">去登录</el-button>
                        <el-button type="primary" @click="gotoOther">去其他页面</el-button>
                        <el-button type="primary" @click="logout">退出登录</el-button>
                    </div>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<script setup lang="ts">
import router from '../router';
import { useLogin } from '../pinia/loginInfo'
import HeaderView from './inc/common/HeaderView.vue';
let store = useLogin()

function gotoLogin() {
    router.push('/login')
}

function gotoOther() {
    router.push('/other')
}
function logout() {
    useLogin().removeToken()
    router.push('/')
}
</script>

<style scoped></style>